package com.shanjupay.merchant.api;

import com.shanjupay.common.domain.BusinessException;
import com.shanjupay.common.domain.PageVO;
import com.shanjupay.merchant.api.dto.MerchantDTO;
import com.shanjupay.merchant.api.dto.MerchantQueryDTO;
import com.shanjupay.merchant.api.dto.StaffDTO;
import com.shanjupay.merchant.api.dto.StoreDTO;

import java.util.List;

public interface MerchantService {


    /**
     * 删除员工
     * @throws BusinessException
     */
    void removeStaff(Long id) throws BusinessException;


    /**
     * 修改员工信息
     * @param staff
     * @throws BusinessException
     */
    void modifyStaff(StaffDTO staff, String [] roleCodes) throws BusinessException;


    /**
     * 查询员工详情
     * @param id
     * @param tenantId
     * @return
     */
    StaffDTO queryStaffDetail(Long id,Long tenantId);


    /**
     * 获取员工详情
     * @param id
     * @return
     */
    public StaffDTO queryStaffById(Long id);

    /**
     * 商户新增员工和账号
     * @param staffDTO
     * @param roleCodes
     * @throws BusinessException
     */
    void createStaffAndAccount(StaffDTO staffDTO, String[] roleCodes) throws BusinessException;


    /**
     * 删除某门店
     *
     * @param id
     * @throws BusinessException
     */
    void removeStore(Long id) throws BusinessException;


    /**
     * 修改门店
     *
     * @param storeDTO
     * @param staffIds
     * @throws BusinessException
     */
    void modifyStore(StoreDTO storeDTO, List<Long> staffIds) throws BusinessException;


    /**
     * 获取门店详情
     *
     * @param id
     * @return
     */
    public StoreDTO queryStoreById(Long id);


    /**
     * 获取门店管理员列表
     *
     * @param storeId
     * @return
     */
    public List<StaffDTO> queryStoreAdmin(Long storeId);


    /**
     * 分页查询商户下的所有员工
     *
     * @param staffDTO
     * @param pageNo
     * @param pageSize
     * @return
     * @throws BusinessException
     */
    PageVO<StaffDTO> queryStaffByPage(StaffDTO staffDTO, Integer pageNo, Integer pageSize) throws BusinessException;


    /**
     * 商户下新增门店,并设置管理员
     *
     * @param storeDTO
     */
    StoreDTO createStore(StoreDTO storeDTO, List<Long> staffIds) throws BusinessException;


    /**
     * 商户资质审核
     *
     * @param merchantId
     * @param auditStatus
     * @throws BusinessException
     */
    void verifyMerchant(Long merchantId, String auditStatus) throws BusinessException;


    /**
     * 商户分页条件查询
     *
     * @param merchantQueryDTO
     * @param pageNo
     * @param pageSize
     * @return
     * @throws BusinessException
     */
    PageVO<MerchantDTO> queryMerchantPage(MerchantQueryDTO merchantQueryDTO, Integer pageNo, Integer pageSize) throws BusinessException;


    /**
     * 查询门店是否属于商户
     *
     * @param storeId
     * @param merchantId
     * @return
     */
    Boolean queryStoreInMerchant(Long storeId, Long merchantId);


    /**
     * 门店列表的查询
     *
     * @param storeDTO 查询条件:必要->商户id
     * @param pageNo   页码
     * @param size     记录数
     * @return
     * @throws BusinessException
     */
    PageVO<StoreDTO> queryStoreByPage(StoreDTO storeDTO, Integer pageNo, Integer size) throws BusinessException;


    /**
     * 根据租户id查询商户信息
     */
    public MerchantDTO queryMerchantByTenantId(Long tenantId);


    /**
     * 员工与门店绑定
     */
    void bindStaffToStore(Long storeId, Long staffId) throws BusinessException;

    /**
     * 新增门店
     *
     * @param storeDTO 门店信息
     * @return 新增成功的门店信息
     * @throws BusinessException
     */
    StoreDTO createStore(StoreDTO storeDTO) throws BusinessException;

    /**
     * 新增员工
     *
     * @param staffDTO
     * @return
     */
    StaffDTO createStaff(StaffDTO staffDTO) throws BusinessException;

    //根据 id查询商户
    public MerchantDTO queryMerchantById(Long id);

    //注册商户
    public MerchantDTO createMerchant(MerchantDTO merchantDTO);

    /**
     * 商户资质申请接口
     *
     * @param merchantId  商户id
     * @param merchantDTO 资质申请信息
     * @throws BusinessException
     */
    void applyMerchant(Long merchantId, MerchantDTO merchantDTO) throws BusinessException;


}
